<template>
  <div class="jsTest">
      <div class="number" @click="changeNumber(0,3000)">
          点击改变数字
      </div>
      <div class="changeNumber">{{anumate}}</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
        anumate:0
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      //数组方法

      let arrs = ["1", "b", "3", "c", "5", "6", "9", "2"];

      let arrs1 = ["a", "b", "c", "d", "e", "f", "g", "i"];
      let newArrs = [];

      let objArras = [
        {
          name: "张无忌"
        },
        {
          name: "张三丰"
        }
      ];

      let name = objArras.some(function(ele) {
        console.log(ele);
        return (ele.name = "张三丰");
      });
      console.log(name);

      // arrs.push("8","9");
      // arrs.unshift("0")
      // arrs.pop()
      //   console.log(arrs)
      //   arrs.shift()
      //    console.log(arrs)
      // let strs=arrs.join(",");
      //     console.log(strs);
      // let delChong=new Set(arrs)
      // console.log(delChong);

      // let newArres=[];

      // let obj={}

      // console.log(Array.isArray(newArres));
      //  console.log(Array.isArray(obj));

      //  if(Array.isArray(newArres)){
      //    console.log("1")
      //  }else{
      //     console.log("0")
      //  }

      // arrs.forEach(function(item,index){
      //     console.log(item+":"+index)
      // });

      // let backNumber=arrs1.find(function(ele,index,array){
      //     console.log(ele+":"+index+":::::::"+array);
      //     return ele==="3";
      // })

      // console.log(backNumber);

      // if(arrs1.includes("a","b")){
      //      console.log("包含")
      // }else{
      //     console.log("不包含")
      // }
    },
    changeNumber (number1,numberMax) {
         let numberText=number1;
         let geo=null;
         let that=this;

         function  numSlideFun(){
            numberText+=1; 
            if(numberText>=numberMax){
             numberText=numberMax;
             cancelAnimationFrame(geo);
            }else{
                geo=requestAnimationFrame(numSlideFun)
            }
            that.anumate=numberText;
         }
         numSlideFun()
    }
  }
}
</script>

<style  scoped>
.jsTest{
    text-align: center;
    margin:20px;
}
.number{
    display:inline;
    padding:10px;
    border:1px solid red;
    cursor:pointer;
}
.changeNumber{
    font-size:60px;
    color:lightcoral;
}
</style>


